package com.lhc.error;

public class BusniessException extends Exception implements CommonError {

    private CommonError commonError;

    public BusniessException(CommonError commonError){
        super();
        this.commonError =  commonError;
    }
    public BusniessException(CommonError commonError, String errMsg){
        super();
        this.commonError = commonError;
        this.commonError.setErrorMessage(errMsg);
    }


    @Override
    public int errorCode() {
        return this.commonError.errorCode();
    }

    @Override
    public String errorMessage() {
        return this.commonError.errorMessage();
    }

    @Override
    public CommonError setErrorMessage(String errorMessage) {
        this.commonError.setErrorMessage(errorMessage);
        return this;
    }
}
